// <copyright>
// Project: sofort.NET
// Date:  2014 - 02 - 04
// Copyright: Karl Haak 2014
// </copyright>
// <author>Karl Haak (www.karlhaak.de)</author>
namespace pay.sofort.Models.Mapping
{
    public class PaySofortTransactionMap : PaySofortBaseMap<PaySofortTransaction>
    {
        public PaySofortTransactionMap()
        {
            // Primary Key
            HasKey(t => t.PaySofortTransactionGuid);

            // Properties
            Property(t => t.transaction_key)
                .IsRequired()
                .HasMaxLength(50);

            Property(t => t.status)
                .IsRequired()
                .HasMaxLength(30);

            Property(t => t.status_reason)
                .IsRequired()
                .HasMaxLength(255);

            Property(t => t.payment_method)
                .IsRequired()
                .HasMaxLength(50);

            Property(t => t.language_code)
                .IsRequired()
                .HasMaxLength(2);

            Property(t => t.currency_code)
                .IsRequired()
                .HasMaxLength(3);

            Property(t => t.reason_1)
                .HasMaxLength(255);

            Property(t => t.reason_2)
                .HasMaxLength(255);

            Property(t => t.reason_3)
                .HasMaxLength(255);

            Property(t => t.user_variable_1)
                .HasMaxLength(255);

            Property(t => t.user_variable_2)
                .HasMaxLength(255);

            Property(t => t.user_variable_3)
                .HasMaxLength(255);

            Property(t => t.sender_holder)
                .HasMaxLength(50);

            Property(t => t.sender_account_number)
                .IsRequired()
                .HasMaxLength(30);

            Property(t => t.sender_bank_code)
                .IsRequired()
                .HasMaxLength(30);

            Property(t => t.sender_bank_name)
                .IsRequired()
                .HasMaxLength(255);

            Property(t => t.sender_country_code)
                .IsRequired()
                .HasMaxLength(2);

            Property(t => t.sender_iban)
                .IsRequired()
                .HasMaxLength(34);

            Property(t => t.sender_bic)
                .IsRequired()
                .HasMaxLength(11);

            Property(t => t.recipient_holder)
                .IsRequired()
                .HasMaxLength(50);

            Property(t => t.recipient_account_number)
                .IsRequired()
                .HasMaxLength(30);

            Property(t => t.recipient_bank_code)
                .IsRequired()
                .HasMaxLength(30);

            Property(t => t.recipient_bank_name)
                .IsRequired()
                .HasMaxLength(255);

            Property(t => t.recipient_country_code)
                .IsRequired()
                .HasMaxLength(2);

            Property(t => t.recipient_iban)
                .IsRequired()
                .HasMaxLength(34);

            Property(t => t.recipient_bic)
                .IsRequired()
                .HasMaxLength(11);

            Property(t => t.email_customer)
                .IsRequired()
                .HasMaxLength(255);

            Property(t => t.phone_customer)
                .IsRequired()
                .HasMaxLength(255);

            Property(t => t.costs_currency_code)
                .IsRequired()
                .HasMaxLength(3);


            // Table & Column Mappings
            ToTable("PaySofortTransaction");
            Property(t => t.PaySofortTransactionGuid).HasColumnName("PaySofortTransactionGuid");
            Property(t => t.project_id).HasColumnName("project_id");
            Property(t => t.transaction_key).HasColumnName("transaction_key");
            Property(t => t.test).HasColumnName("test");
            Property(t => t.transaction_created).HasColumnName("transaction_created");
            Property(t => t.status).HasColumnName("status");
            Property(t => t.status_reason).HasColumnName("status_reason");
            Property(t => t.status_history).HasColumnName("status_history");
            Property(t => t.status_modified).HasColumnName("status_modified");
            Property(t => t.payment_method).HasColumnName("payment_method");
            Property(t => t.language_code).HasColumnName("language_code");
            Property(t => t.amount).HasColumnName("amount");
            Property(t => t.amount_refunded).HasColumnName("amount_refunded");
            Property(t => t.currency_code).HasColumnName("currency_code");
            Property(t => t.reason_1).HasColumnName("reason_1");
            Property(t => t.reason_2).HasColumnName("reason_2");
            Property(t => t.reason_3).HasColumnName("reason_3");
            Property(t => t.user_variable_1).HasColumnName("user_variable_1");
            Property(t => t.user_variable_2).HasColumnName("user_variable_2");
            Property(t => t.user_variable_3).HasColumnName("user_variable_3");
            Property(t => t.sender_holder).HasColumnName("sender_holder");
            Property(t => t.sender_account_number).HasColumnName("sender_account_number");
            Property(t => t.sender_bank_code).HasColumnName("sender_bank_code");
            Property(t => t.sender_bank_name).HasColumnName("sender_bank_name");
            Property(t => t.sender_country_code).HasColumnName("sender_country_code");
            Property(t => t.sender_iban).HasColumnName("sender_iban");
            Property(t => t.sender_bic).HasColumnName("sender_bic");
            Property(t => t.recipient_holder).HasColumnName("recipient_holder");
            Property(t => t.recipient_account_number).HasColumnName("recipient_account_number");
            Property(t => t.recipient_bank_code).HasColumnName("recipient_bank_code");
            Property(t => t.recipient_bank_name).HasColumnName("recipient_bank_name");
            Property(t => t.recipient_country_code).HasColumnName("recipient_country_code");
            Property(t => t.recipient_iban).HasColumnName("recipient_iban");
            Property(t => t.recipient_bic).HasColumnName("recipient_bic");
            Property(t => t.email_customer).HasColumnName("email_customer");
            Property(t => t.phone_customer).HasColumnName("phone_customer");
            Property(t => t.exchange_rate).HasColumnName("exchange_rate");
            Property(t => t.costs_fee).HasColumnName("costs_fee");
            Property(t => t.costs_currency_code).HasColumnName("costs_currency_code");
            Property(t => t.costs_exchange_rate).HasColumnName("costs_exchange_rate");
            Property(t => t.su_consumer_protection).HasColumnName("su_consumer_protection");
        }
    }
}